module.exports = class extends think.global.service {
  async indexAction() {
    Object.assign(this.$config.params, this.get())
    if (this.method === 'GET') { // get为获取自定义常用回复
      try {
        let result = await think.http.get(this.$url, this.$config)
        console.log(result.data)
        this.json(result.data)
      } catch (e) {
        this.ctx.fail(1000, e.message)
      }
    } else { // post为设置自定义回复
      try {
        let result = await think.http.post(this.$url, this.post(), this.$config)
        console.log(result.data)
        this.json(result.data)
      } catch (e) {
        this.ctx.fail(1000, e.message)
      }
    }
  }
};